#include "Support.h"

void Init()
{
	SetConsoleTitle("My Game");

	GSetCursorVisiable();
	GSetFont(8, 8, 100, GFontFamilys::MODERN);
	GSetNoScroolBar();
}

//Put char/string to buffer with margin
void GPutCharToBufferWithMargin(char c, int line, GColors text_color, GColors background_color, GMargins margin)
{
	//Find x position suit with margin
	int x;
	if (margin == GMargins::M_CENTER)
	{
		x = (WIDTH - 1) / 2;
	}
	else if (margin == GMargins::M_LEFT)
	{
		x = 0;
	}
	else
	{
		x = WIDTH - 2;
	}

	GPutCharToBuffer(c, x, line, text_color, background_color);
}

void GPutStringToBufferWithMargin(char str[], int line, GColors text_color, GColors background_color, GMargins margin)
{
	//Find x position suit with margin
	int x;
	if (margin == GMargins::M_CENTER)
	{
		x = (WIDTH - 1) / 2 - strlen(str) / 2;
	}
	else if (margin == GMargins::M_LEFT)
	{
		x = 0;
	}
	else
	{
		x = WIDTH - 1 - strlen(str);
	}

	GPutStringToBuffer(str, x, line, text_color, background_color);
}